/*
 * Package: org.grassfield.common.dao
 * FileName: AuditLogDAOTest.java
 *  
 * Created by pandian on Jan 28, 2011
 */
package dao;

import java.util.Date;

import bean.AuditLog;

import test.BaseTest;




/**
 * A junit test case for AuditLogDAO.
 */
public class AuditLogDAOTest extends BaseTest {
	private IAuditLogDAO auditLogDAO;
	private IUserDAO userDAO;
	

	/**
	 * Sets the audit log dao.
	 * 
	 * @param auditLogDAO the new audit log dao
	 */
	public void setAuditLogDAO(IAuditLogDAO auditLogDAO) {
		this.auditLogDAO = auditLogDAO;
	}


	/**
	 * Sets the user dao.
	 * 
	 * @param userDAO the new user dao
	 */
	public void setUserDAO(IUserDAO userDAO) {
		this.userDAO = userDAO;
	}


	/**
	 * Test case for add.
	 */
	public void testAdd() {
		AuditLog auditLog = new AuditLog();
		auditLog.setLogTime(new Date());
		auditLog.setLogType("TEST");
		auditLog.setMessage("test log added");
		auditLog.setUser(this.userDAO.getUser(1L));
		auditLog.setStatus("SUCCESS");
		this.auditLogDAO.add(auditLog);
		super.assertNotNull("id is null", auditLog.getId());
		System.out.println("audit log id:"+auditLog.getId());
	}

}
